classify={

    getclassify: function () {
        interface.service.getclassify(null, function (data) {
            console.log(data);
            var size = data.data.length;
            var colum = size / 4;
            var classifyhtml = '';
            for(var i = 0 ;i <= colum ;i ++){
                var ulhtml = '<ul class="contain-ul clear">';
                for(var j = 0 ;j < 4;j ++){
                    if(4 * i + j >= size){
                        break;
                    }
                    var classifyobj = data.data[4 * i + j];
                    var classifdsd = classifyobj.classifyname ;
                    var classifid = classifyobj.classifyid ;
                    if(j == 3){
                        ulhtml += '<li class="contain-li"><a href="/detail?'+classifid+'">'+classifdsd+'</a></li>';
                    }else{
                        ulhtml += '<li class="contain-li margin-right"><a href="/detail?'+classifid+'" >'+classifdsd+'</a></li>';
                    }

                }
                ulhtml += '</ul>';
                classifyhtml += ulhtml;
            }
            $("#classify").html(classifyhtml);
        });

    },

    getDetailByClassifyid: function () {
        var query = window.location.search.substring(1);
        var param = {"classifyid":query};
        interface.service.getDetailByClassifyid(param, function (data) {
            console.log(data);
            var imgdata = data.data;
            var html = '';
            for(var i = 0 ;i < imgdata.length ;i ++){
                var imgname = imgdata[i].name;
                var imgurl = imgdata[i].url;

                var ulhtml = '<li class="margin-right">';
                     ulhtml += '<div>';
                             ulhtml += '<a target="_blank" href="'+imgurl+'">';
                                ulhtml += '<img class="picture" src="'+imgurl+'" alt="" style="width: 188px; height: 188.462px;">';
                              ulhtml += '</a>';
                             ulhtml += '<span>'+imgname+'</span>';
                    ulhtml += '</div>';
                ulhtml += '</li>';
                html += ulhtml;
            }
            $("#pictures").html(html);
        });

    },

}